/*
 * This file Copyright (c) 2015. Walle.
 * (http://www.wallellen.com). All rights reserved.
 *
 *
 * This file is dual-licensed under both the
 * Walle Agreement (WA) and the GNU General Public License.
 * You may elect to use one or the other of these licenses.
 *
 * This file is distributed in the hope that it will be
 * useful, but AS-IS and WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE, TITLE, or NONINFRINGEMENT.
 * Redistribution, except as permitted by whichever of the GPL
 * or WA you select, is prohibited.
 *
 * 1. For the GPL license (GPL), you can redistribute and/or
 * modify this file under the terms of the GNU General
 * Public License, Version 3, as published by the Free Software
 * Foundation.  You should have received a copy of the GNU
 * General Public License, Version 3 along with this program;
 * if not, write to the Free Software Foundation, Inc., 51
 * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * 2. For the Walle Agreement (WA), this file
 * and the accompanying materials are made available under the
 * terms of the WA which accompanies this distribution, and
 * is available at http://www.wallellen.com/agreement.html
 *
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
 */

package com.wallellen.wda.inter;

import com.wallellen.wda.exception.ErrorTypeException;

import java.io.File;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.Set;

/**
 * wda远程调用接口
 *
 * @author <a href="mailto:wallellen@hotmail.com">WALLE</a>
 */
public interface WdaAppInter extends Remote {

    /**
     * 开始生产WEB文档
     *
     * @param key      文档关键字，后续通过它调用相关资源
     * @param file     原文件
     * @param htmlinfo 被显示的html信息（如文件名称等）
     * @throws ErrorTypeException
     * @throws java.rmi.RemoteException
     */
    public void generateDoc(String key, File file, String htmlinfo) throws ErrorTypeException, RemoteException;

    /**
     * 开始生产WEB文档
     *
     * @param key          文档关键字，后续通过它调用相关资源
     * @param file         原文件
     * @param fileTypeName 扩展名
     * @param htmlinfo     被显示的html信息（如文件名称等）
     * @throws ErrorTypeException
     * @throws java.rmi.RemoteException
     */
    public void generateDoc(String key, File file, String fileTypeName, String htmlinfo)
            throws ErrorTypeException, RemoteException;

    /**
     * 获得可以被转换的文件类型
     *
     * @return
     */
    public Set<String> getSupportTypes() throws RemoteException;

    /**
     * 文档是否已经生成完毕
     *
     * @param key
     * @return
     * @throws ErrorTypeException
     */
    public boolean isGenerated(String key, String doctype) throws ErrorTypeException, RemoteException;

    /**
     * 文档是否有日志记录
     *
     * @param key
     * @return
     * @throws ErrorTypeException
     */
    public boolean isLoged(String key) throws RemoteException;

    /**
     * 删除日志（通过日志判断是否生成过文档时，可以通过此方法重新生成文档）
     *
     * @param key
     * @return
     * @throws ErrorTypeException
     */
    public void delLog(String key) throws RemoteException;

    /**
     * 获得日志地址
     *
     * @param key
     * @return
     */
    public String getlogURL(String key) throws RemoteException;

    /**
     * 获得文档文本字符串
     *
     * @param key
     * @return
     * @throws ErrorTypeException
     */
    public String getText(String key) throws ErrorTypeException, RemoteException;

    /**
     * 获得文档信息字符串
     *
     * @param key
     * @return
     * @throws ErrorTypeException
     */
    public String getInfo(String key) throws ErrorTypeException, RemoteException;

    /**
     * 获得在线文档浏览的URL
     *
     * @param key
     * @param exname
     * @return
     * @throws ErrorTypeException
     */
    public String getUrl(String key, String docType) throws ErrorTypeException, RemoteException;

}
